package com.jackson.service.impl;

import com.jackson.dao.IUserDao;
import com.jackson.dao.impl.UserDaoImpl;
import com.jackson.service.IUserService;
import com.jackson.utils.BeanFactory;

/*
 * @ClassName UserSerivceImpl
 * @Author JacksonCode
 * @Version V1.0
 */
public class UserServiceImpl implements IUserService {

//    private IUserDao userDao;
//
//    public void setUserDao(IUserDao userDao) {
//        this.userDao = userDao;
//    }

    @Override
    public void save() {
//        IUserDao userDao = new UserDaoImpl();
//
//        userDao.save();
        // 反射
//        IUserDao userDao = (IUserDao) Class.forName("com.lagou.dao.impl.UserDaoImpl").newInstance();

        IUserDao userDao = (IUserDao) BeanFactory.getBean("userDao");
        userDao.save();

    }
}
